home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Cracking / Crack-It-Up.sit / Crack-It-Up / Crack-It-Up.rsrc / TEXT_147.txt < prev    next >
Text File  |  2000-01-29  |  25KB  |  440 lines

  1.  
  2. How to Crack: MAC [by The Vassal] 
  3.  
  4. Hopefully this will be an informative work. One in which I will attempt to
  5. instruct you all how to successfully remove some of the more basic Mac protection
  6. schemes easily, the right way. Before we start anything, however, there are a few
  7. things that you will need. They are:
  8.  
  9. *  Mac Plus or better w/1 meg of RAM suggested
  10. *  MacsBug (Debugger from APDA)
  11. *  Programmer‚Äôs Key (Can invoke MacsBug from Keyboard)
  12. *  DisAsm 3.1 (Shareware disassembler)
  13. *  FEdit 3.21 (Shareware Sector editor)
  14. ...and 
  15. *  A working knowledge of 68000 Assembler
  16.  
  17. Ok, whether or not you believe in Shareware, it is a good system and the programs
  18. mentioned above are all capable of being commercial packages, so please pay the
  19. tiny shareware fee so the authors will continue to make them better. Thanks.
  20.  
  21.  
  22. Chapter 1- It's a Scheme Game 
  23.  
  24. The first thing you should do before you crack any ware is to identify completely
  25. what scheme they are using to protect their ware. On the Mac, schemes are usually
  26. basic and easy to get around. Some of the more common ones include: 
  27.  
  28. *  Password Protection
  29. *  Serial Number Protection,
  30. *  Key Disk Protection
  31. *  Date Expiration Protection (for Betas usually) 
  32. *  HardWare Key Protection
  33.  
  34. We‚Äôll look at these schemes one at a time and I will provide examples for each
  35. later. Right now, I want to explain how to determine what protection is what.
  36. First off, before you do anything make a backup of the application you are going
  37. to tamper with. This way if you screw up you will have something to go back to
  38. later.
  39.  
  40. Ok, now when you launch the application a couple of different protection schemes
  41. will surface immediatly. If a dialog comes up immediatly and asks you to type
  42. something in, it is almost always a Password Protection Scheme or a Serial Number
  43. Scheme. Key Disk Protection Schemes will ask you to insert a floppy so it can
  44. read important data from it and then continue with the program as normal. The
  45. Date Expiration Protection Scheme is never really noticed until it expires, then
  46. everytime you run the program it will tell you it has expired and will then quit.
  47.  
  48. Probably the most overated protection scheme going is that of hardware 'key' or
  49. 'dangle' protection. Usually the software package would ship with a hardware
  50. device that you would connect to the ADB port, Serial Port, or SCSI port. The
  51. different methods of checking the hardware will be described in detail later on
  52. in this document. No need to swamp you with technical stuff just yet.
  53.  
  54. Chapter 2- The Tools of Cracking 
  55.  
  56. As I mentioned earlier you will need certain programs to help you along in the
  57. deprotection process.
  58.  
  59. MacsBug: Is a full-featured debugger that allows you to set traps in
  60.                  programs and then trace through instruction by
  61.                  instruction. This is an immeasurably useful program. It
  62.                  has loads of commands, but I only use these commands
  63.                  for cracking:
  64.  
  65. atb [trap]            ; lets you set a trap that which will break you into
  66. MacsBug if 
  67.                           the program tries to exectute it. Mac Traps are from
  68. A000-
  69.                           AFFF and do many different things like _Eject &
  70. _ExitToShell
  71.                           and stuff like that.
  72. atc                   ; this will clear all of the traps t hat you set with atb
  73. es                    ; quit current application and exit to shell
  74. ea                    ; quit current application then launch it again
  75.  G                    ; go. Continue the application as normal. Turn off MacsBug.
  76. GT [addr]             ; lets you GO from a selected address.
  77. il [addr] n           ; lists from selected address "n"= number of lines
  78. ?                     ; This displays the online help file, very useful
  79.  
  80. These are the commands I use most of the time. There are other commands which are
  81. more complicated and do some special things but there is no need to explain them
  82. here. I will do that in a future issue.
  83.  
  84. FEdit 3.21: This is a very good sector/file editor with good search functions for
  85. finding certain code and changing it. This is very much like any other editor so
  86. there is no need to explain its functions.
  87.  
  88. DisAsm 3.1: This is a disassembler, the only one I have seen on the Mac so far
  89. and it works pretty good. All functions are operated from the Menus, but the main
  90. ones I use are the Search functions. Like finding certain traps, are certain
  91. addresses. I don‚Äôt really use this much but if needed it is good to have a
  92. disassembler around. Sometimes MacsBug won‚Äôt quite work if a program steals
  93. memory away from it and DisAsm must be used as a last resort.
  94.  
  95. Programmer's Key: This is a nifty little INIT that lets you invoke MacsBug from
  96. the keyboard. Basically you hit the Command-Reset keys and it dumps you into
  97. MacsBug, you can also hit Control-Command-Reset to restart your computer. Which
  98. is kind of neat. I recommend using this instead of the hardware interupt switch
  99. on the machine itself, mostly because its a pain to keep reaching in back of your
  100. machine to do it.
  101.  
  102. Chapter 3- Assembly is the key to the crack
  103.  
  104. It is extremely important to have a background in Assembly language if you want
  105. to get far cracking. To tell you the truth I used to be into programming the
  106. Apple II and IIgs in Assembly language. When I moved over to the Mac, I found out
  107. everything was C and Pascal, which disturbed me. C and Pascal allow you to
  108. program without having a clue what is really going on. I don‚Äôt like the idea of
  109. it at all. Most people think cracking is something for people who know how to
  110. program, but the truth is, I haven‚Äôt written a damn thing for the Mac as far as
  111. applications go, because I don‚Äôt know how. I could probably write something in
  112. assembly, but I just don‚Äôt have a nice assembler like Merlin on the Mac.
  113.  
  114. Some day, I recommend you buy a good 68000 reference manual so you can learn the
  115. processor. That‚Äôs what I did but Apple II assembly knowledge helped me out alot.
  116. Assembly languange on the Mac is a bit more complicated than that of the Apple
  117. II; on the Mac memory is moved not loaded or stored.  
  118.  
  119. On the Apple II and IIgs there are three registers you would normally use to
  120. store data in. The A or Accumulator, the X Register, and the Y Register. The Mac
  121. has 16 registers that can be used in this manner. They are D0-D7 which are 8 data
  122. registers for storing data, they are all capable of holding 32-bits worth of
  123. data. You can access or change these the low 8-bits, the low 16-bits or all
  124. 32-bits, changing the low byte or word has no affect on the remaining unchanged
  125. portion. There are also 8 address registers from A0-A7 but A7 is usually used as
  126. a stack pointer for the 68020 and is also known as the SP in this situation. The
  127. address registers are basically the same as the data registers but they can only
  128. be accessed using all 32-bits. Changing the low word of an address register
  129. replicates the bit 15 in bits 16-31. This is called sign extension, which
  130. converts a two's complement 16-bit quantity into an equivalent 32-bit quantity.
  131.  
  132. Another register on the Mac worth noting is the program counter (PC) register.
  133. This holds the address of the next instruction to be executed, and is very useful
  134. in tracing code.
  135.  
  136. There are many more opcodes in the 68000 instruction set then there are in the
  137. 6502 or 65c816, too many to list here. In the crack examples I will explain
  138. everything very thoroughly so you can get an idea of what is going on, and
  139. understand it.  
  140.  
  141. MacsBug and DisAsm both list Assembler in the same manner. They list the address
  142. on the left hand side, the opcode and effected address or values in the middle
  143. and the hex values on the right hand side. This is how I will lit my code, but I
  144. will add in descriptions on what it is the code is actually doing. Here is an
  145. example of what I mean:
  146.  
  147. 611F04:   Move.L    D0,D1     ;2200     : this moves the contents of
  148.                                                            D0 into D1
  149.  
  150. That's just an example, but it is very common to see code like that. The thing
  151. that is cool about MacsBug is that it lists all of the Address and data registers
  152. on the left part of the screen from top to bottom along with other system
  153. registers.
  154.  
  155. Another important aspect of 68000 and higher processors is that they use branches
  156. the same way the Apple II did, only that there are many more different branch
  157. instructions and they are much more powerful.   Here are a examples of branch
  158. opcodes for the 68000 series processors (used in Macs):
  159.  
  160. Hex Instr.            Ex.               Meaning
  161.       [$60]            $60xx            BRA (BRanch Always). This instruction
  162. always 
  163.                                                     branches to an address $xx
  164. bytes in front of 
  165.                                                     where the instruction was
  166. passed.
  167.  
  168.       [$66]            $66xx            BNE (Branch if Not Equal). This
  169. instruction will 
  170.                                                     branch ahead $xx bytes in
  171. front of where the 
  172.                                                     instruction was just passed.
  173.  
  174. There are 16 in all but I would rather not make this publication into an
  175. Assembler Reference book. I will put out one of those in the future maybe. I do
  176. suggest getting a 68000 quick reference though. On we go.
  177.  
  178. Chapter 4 - Key Code Protection
  179.                 Example: Quick Format 7.0 
  180.  
  181. The first type of protection scheme I would like to explain is the Key Code
  182. Scheme. This is used in Quick Format 7.0, which is a Public Domain Shareware
  183. program that is very good at formatting floppies and designing your own labeling
  184. scheme those floppies. It is definately worth the Shareware fee, so I suggest if
  185. you like the program to buy it, you can probably find it on many online services
  186. and from user groups.
  187.  
  188. The author decided to put in a registration algorithm which requires its users to
  189. type in a key code to access the advanced features of the program. When you first
  190. launch the Quick Format 7.0 application, a dialog box comes up and asks you to
  191. enter in the key code. If no key code is entered or you hit the return key, the
  192. program would continue to run, but with the advanced options turned off.
  193.  
  194. The author is doing a couple of different little things. First, he is going to
  195. check somewhere within his resource files to see if the current application being
  196. used is registered. Usually there is a register byte in a resource somewhere in
  197. the app. He will then do a compare to see if it really is registered. If it is,
  198. it continues like normal, if it isn‚Äôt registered, it will jump to another routine
  199. which turns off the advanced options and then runs the app as normal.
  200.  
  201. There are a few options we have when deprotecting this app. We can use MacsBug to
  202. trace through for the routine, then disassemble it to see where it does the
  203. compare; or we can use ResEdit to find a resource that looks suspicious and
  204. delete it. The latter might be a little tedious and it is always much more
  205. interesting tracing through code.
  206.  
  207. Now we will deprotect Quick Format 7.0. For best results and for speed and memory
  208. purposes quit all other applications you are currently running. When you are back
  209. at the Finder, hit ‚ÄúCommand-Reset‚Äù or reach in back of your machine and press the
  210. hardware interrupt switch, this will activate MacsBug. Your screen should have
  211. cleared and you should be looking at a white screen with numbers on the left hand
  212. quadrant of the screen running from TOP to BOTTOM. Those numbers are the various
  213. addresses and registers in memory.
  214.  
  215. Running along the bottom of the screen from LEFT to RIGHT are two separate boxes.
  216. The box on the big box with the numbers in it is a disassembly of the location in
  217. memory you just broke into with MacsBug. The smaller box under it is the MacsBug
  218. command line. On the far left you should notice a blinking cursor. From the
  219. command line you can execute different commands to help you trace through
  220. programs, especially useful in deprotecting software. At the command line type
  221. ‚Äú?‚Äù (help). This will print up a list of different topics. If you keep hitting
  222. return it will give you information about each topic in the order they are shown
  223. on the screen. So play around and hit return a few times to get an idea of what
  224. commands you can use.
  225.  
  226. Now that you are done playing let‚Äôs get started. I almost always set a TRAP for
  227. an _InitGraf. You can do this by typing
  228.                              'ATB INITGRAF'
  229.  
  230. A message should appear above the disassembly box saying 'A-Trap Break at A86E
  231. (_InitGraf)' everytime. What this means is that the program will be stopped and
  232. MacsBug will take over everytime the program tries to execute an _InitGraf. This
  233. works the same way for all of the other trpas that the Mac toolbox has as well.
  234.  
  235. Ok, now type 'G' on the MacsBug command line. This should bring you right back to
  236. the Finder where you started, and you will regain control of your Mac. Locate
  237. Quick Format 7.0 and launch it. Almost immediately your screen should change back
  238. into the MacsBug screen. There should be a message saying 'A-Trap break at
  239. XXXXXXX : A86E (_InitGraf)'. This means when you launched the program, MacsBug
  240. halted it because the program tried to pass an _InitGraf trap. Now that the
  241. program is halted, you can TRACE through the program to find the copy protection.
  242. You may not successfully pinpoint the protection to any one specific area until
  243. you have traced through a number of times.
  244.  
  245. Use the 'T' command to trace through. The object is to continue hitting 'T' and
  246. return until the protection scheme comes up. Eventually it will. When you do get
  247. it up look at the last few lines of code that was passed and you should see
  248. something like this:
  249.  
  250. Addr            Instruction                     Hex Bytes
  251. 583834        JSR SETUPMEN                     4EBA FE14
  252. 583838        JSR INITIALI                     4EAD 02E2
  253. 58383C        JSR INITGLOB                     4EBA FEBE
  254. 583840        JSR VIRALCHE                     4EBA FF22
  255. 583844        JSR CHECKMOR                     4EBA F82A
  256.  
  257. Now, it‚Äôs pretty obvious from just looking at the labels they used that you can
  258. determine what is going on. In most cases people would not use LABELS like the
  259. ones above, but since it is shareware and not a $500 commercial package I can see
  260. why the author opted the easier route for programming ease. The first JSR would
  261. probably be him initializing his menus and stuff. The second JSR would be to
  262. initialize the screen and the fonts or whatever, the third JSR would be
  263. initializing the global variables he would need and the fourth would be to check
  264. for any virus, persay. The fifth however is the routine he uses to check if the
  265. program has been registered and brings up the dialog asking you to enter a key
  266. code. If it hasn‚Äôt been registered with the correct keycode the program turns off
  267. some options. But, that is not necessary, as by omitting this JSR CHECKMOR you
  268. will remove the check and the program will run with all options available. 
  269.  
  270. Write down the last 10 or so bytes on a piece of paper noting that 4EBA F82A is
  271. what you will have to change. Since you want to omit these bytes you are best off
  272. using two NOP (or No OPeration) commands. The hex value for a NOP is 4E71. Now
  273. run FEdit and open up the Quick Format 7.0 program and do a HEX SEARCH for the
  274. bytes you wrote down on the paper. Then change the proper values and you will be
  275. all set. Here is what you should be looking for and the change you should be
  276. making:
  277.  
  278. Byte Changes (You should find the SEARCH string only ONE TIME!)
  279.  
  280. Search : 4EBA FE14 4EAD 02E2 4EBA FEBE 4EBA FF22 4EBA F82A
  281. Change :                                         4E71 4E71
  282.  
  283. The protection showed above is obviously an easy scheme to get around, and to
  284. tell you the truth, there really aren‚Äôt that many hard schemes on the Mac, like
  285. there are or were on the Apple II. It is important to check the routine you are
  286. disabling. Sometimes variables (or globals) are passed in between different parts
  287. of protection schemes, if you skip the entire protection scheme there is a pretty
  288. good chance you will miss a variable (or global) getting passed and your program
  289. will crash on you in the future.
  290.  
  291. The best way to check is to use the program after you have initially deprotected
  292. it, if it works ok, then chances are no globals were passed. In the example
  293. above, all of the globals were passed in the prior two JSRs, which made things
  294. very easy. 
  295.  
  296. Chapter 5 - Serial Number Schemes 
  297.  
  298. Serial Number Protection Schemes are the same as Password Protection Schemes in
  299. most cases. Both are checked with memory using a compare instruction, but they do
  300. have differences. For example, certain serial number schemes are actually
  301. mathematical answers where the application will perform some complex arithmetic
  302. equation using such information as your name or company name, if the equations
  303. solution matches the serial number you type in the program will continue on like
  304. normal.
  305.  
  306. Some serial number schemes are easy and do not use any arithmetic all, some check
  307. to see if you enter a prime number, etc. There are many ways. Probably the most
  308. common is; the company making the software will add a resource to the application
  309. housing the serial number. When the package first loads, it will ask you for your
  310. serial number then will do a compare with the value entered and the value stored
  311. in the serial number resource.  
  312.  
  313. Chapter 6- Key Disk Protection Schemes 
  314.  
  315. There are a couple of different ways commercial software authors implement Key
  316. Disk Protection. Key disk protection essentially is software that requires the
  317. original floppy diskettes to run correctly. These types of programs come with an
  318. installer for copying them onto a hard drive. Some packages offer three installs
  319. to a hard drive; if you need more copies, you have to use the original disk each
  320. time you run that program.
  321.  
  322. Essentially what is happening here is this. On the floppy disk there are files
  323. with their INVISIBLE bit set meaning they will not bee seen or accounted for in
  324. the volume info. Therefore, if you try to copy the program onto a hard drive the
  325. invisible files will not be copied and the copy will not work properly. If you
  326. just turn the INVISIBILITY bit off using ResEdit and then copy the files, the
  327. program will work. But, this is only for programs that do not always need the key
  328. disk. Other programs require the key disk every time you run the application. In
  329. those cases, the key disk has a purposely bad block. When you run the
  330. application, it will read from the floppy and test the block‚Äôs status. If it is
  331. bad it will continue on knowing it is the original disk, it the block is ok it
  332. means that the program has been copied onto another disk which is not the
  333. original or key disk. The best way to operate around this scheme is to trace
  334. through the program to where it actually reads from the floppy, then change the
  335. BRANCH condition after the COMPARE. This will fool the program into always
  336. thinking that the block that is read is bad.
  337.  
  338.  
  339. Chapter 7- Date Expiration Schemes 
  340.  
  341. These schemes occur out of the blue without notice most of the time. Most apps
  342. that use this scheme are beta apps that are expected to be updated before too
  343. long or demos of games and such. There are only two ways to read the current date
  344. or time on a Macintosh, one is to use the _GetDateTime trap the other is to use
  345. the Macintosh Global variable memory address $020C at which the current number of
  346. seconds that has elapsed since Midnight, January 1st is stored. Basically both
  347. routines are extremely similar and would probably look something like this:
  348.  
  349. _GetDateTime (Protection Method)
  350.  
  351.           _GetDateTime               (Get current # of secs since 12am 01/01/04)
  352.           CMPI.L expiredate,D1 (Compare the date with expiration date)
  353.           BLE        notexpired       (If less than, then it hasn't expired)
  354.           JSR        EXPIRED!         (Otherwise show the dialog and bomb out!)
  355.  
  356.  Address $020C (Protection Method)
  357.  
  358.           CMPI.L expiredate,$020C (Compare the current date with expire date)
  359.           BGT        EXPIRED              (If current date is > then expire date,
  360. show dialog 
  361.                                                       & BOMB!)
  362.           ---------                       (otherwise it hasn't expired and
  363. everything is 
  364.                                                        ok!)
  365.  
  366. That should have given you some idea what the protection schemes look like, they
  367. vary of course but that is what they will normally be like. The simple way to
  368. disarm these routines is to change the Branch Condition, for instance in the
  369. first protection scheme shown above it would be extremely easy to change the BLE
  370. to a BRA which will automatically branch to the ‚Äúnotexpired‚Äù portion of the
  371. program. 
  372.  
  373. For the second routine has an easy way to eliminate the protection scheme. It
  374. would be to change the 'BGT EXPIRED' into two NOPs. Which will totally eliminate
  375. the check and fool the program into thinking everything is ok.  
  376.  
  377.  
  378. Chapter 8- Hardware Key Protection
  379.  
  380. Not many people know too much about this protection scheme. But one obvious
  381. observation is that companies are making there own devices and confused companies
  382. with low marketshare are buying into there hardware protection scheme, which
  383. really is not that good to tell you the truth.
  384.  
  385. Basically what the Eve‚Ñ¢ hardware key does is it hooks up to your ADB port and
  386. has a chip in it which can be read from. All of the packages I have seen that use
  387. the Eve‚Ñ¢ protection key come with an Eve INIT. Basically this INIT reads one or
  388. more values from the Eve key and stores it somewhere in memory. The program that
  389. will then do a Compare to the memory to see if the values match if they do then
  390. the program will continue, however if there is a null value found the program
  391. will warn you that the Eve Key is not present and then quit. If the value is
  392. incorrect it will tell you that you either have the Eve hooked up incorrectly or
  393. that you are using an Eve from a different software package.
  394.  
  395. The easiest way around the Eve Hardware key would be to change the Branch
  396. conditions of the checks it does 1) to locate Eve and 2) to compare the values.
  397. Once you have changed these branch conditions the program will work as it would
  398. have if the Eve protection had not been implemented.  
  399.  
  400. From what I have heard some software locations or other important data to the
  401. program is stored in the Eve‚Ñ¢ that may be needed upon run time. For example, if
  402. a program is encrypted and the decryption routine is stored on the Eve‚Ñ¢ key it
  403. would be almost impossible to deprotect the program without a valid Eve‚Ñ¢ key to
  404. work with.  
  405.  
  406. So, I would just use MacsBug the way we have been and just trace through for the
  407. checks. Eve‚Ñ¢ will let you know when something is wrong through the use of
  408. dialogs, so tracing is pretty easy. Find those branches and change the
  409. conditions.
  410.  
  411.  
  412. Chapter 9- The Ultimate Protection Scheme
  413.  
  414. This is a hotly debated topic. Most people would say that no protection scheme
  415. can go uncracked, but I beg to differ. I am sure I can stir something up that
  416. will boggle a few minds for at least 6 months of everyday tracing. Which will
  417. probably force that cracker to stop working on it.  
  418.  
  419. In this day and age all software should be unprotected and should be available
  420. through the Shareware system. Corporate America is crippling our economy and the
  421. only ones benefitting from it are the few 'elite' businessmen or businesswomen.
  422.  
  423. The Shareware system ensures that the people/programmers who put their time and
  424. effort into their projects recieve all of the money they bring in. Thats what
  425. Corporate America should be like. Spread the wealth amongst everyone. And work
  426. for the money you make, don‚Äôt cheat anyone out of it.
  427.  
  428. 'This article is written in memory of the old apple pirates who have paved the
  429. way for a new breed of "elite pirate" life form. Hadn't it been for their
  430. patience and instruction our generation of pirates would have died off long ago.
  431. Now I pass onto you my knowledge and ideas in hope that you will all use it,
  432. share it, work together with it and be "elite" toward one another. '
  433.                                                                                 
  434. The Vassal
  435.  
  436.  
  437. Many thanks to: Hipcheck, Agent Orange, The Terrorist and HackMan
  438.  
  439. Also thanks to: Far Side, Jim Heebner, Zelig, ShadowMan, The Embalmer, Mr_T, The Wahoo, Grimm, Enigmatic Simplicity, Gandalf Greyhame, and (High Voltage for reminding me what the Apple II days were really like)...
  440.